import java.util.Scanner;

public class Avg {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double sum = 0, score;
		int i = 1;
		for (; i <= 5; i++) {
			System.out.println("请输入" + i + "门课的成绩：");
			score = sc.nextDouble();
			if (score < 0) {
				System.out.println("输入成绩错误！");
				break;

			}
			sum = sum + score;
		}
		// 区分是正常的循环退出还是有异常提前退出
		// 正常退出，i等于6
		if (i > 5) {
			double avg = sum / 5;
			System.out.printf("平均分是%7.2f", avg);
		}
	}
}
